package org.opens.guava;

import com.google.common.collect.ComparisonChain;
import lombok.AllArgsConstructor;

@AllArgsConstructor
public class CompareEntity implements Comparable<CompareEntity> {

    private Integer id;

    private String name;

    private Integer old;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getOld() {
        return old;
    }

    public void setOld(Integer old) {
        this.old = old;
    }

    @Override
    public int compareTo(CompareEntity o) {
        return ComparisonChain
                .start()
                .compare(id, o.getId())
                .compare(name, o.getName())
                .compare(old, o.getOld())
                .result();
    }

}
